<?php

namespace App\Models\Order;

use Hyn\Tenancy\Traits\UsesTenantConnection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Models\Order\OrderBundleItem
 *
 * @property int $id
 * @property int $order_bundle_id
 * @property string $name 资产名称
 * @property int $rentalable_id
 * @property string $rentalable_type
 * @property int $quantity 数量
 * @property float $unit_price 单价
 * @property float $amount 价格
 * @property string|null $rental_out_at 出库时间
 * @property string|null $return_at 入库时间
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \App\Models\Order\OrderBundle $orderBundle
 * @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $rentalable
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Order\OrderBundleItem onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereAmount($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereOrderBundleId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereQuantity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereRentalOutAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereRentalableId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereRentalableType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereReturnAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereUnitPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundleItem whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Order\OrderBundleItem withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Order\OrderBundleItem withoutTrashed()
 * @mixin \Eloquent
 */
class OrderBundleItem extends Model
{
    use SoftDeletes, UsesTenantConnection;


    public function orderBundle()
    {
        return $this->belongsTo(OrderBundle::class);
    }

    public function rentalable()
    {
        return $this->morphTo()->withTrashed();
    }
}
